home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / printing / rlpr-1.000 / rlpr-1 / rlpr-1.13 / rlpr-common.h < prev    next >
C/C++ Source or Header  |  1996-06-30  |  4KB  |  100 lines

  1. /* filename: rlpr-common.h
  2.  * project: rlpr
  3.  * author: meem  --  meem@sherilyn.wustl.edu
  4.  * version: $Id: rlpr-common.h,v 1.4 1996/07/01 01:06:35 meem Exp $
  5.  * contents: common #defines, headers for general-purpose rlpr functions
  6.  *
  7.  * Time-stamp: <1996/06/30 20:08 -- meem@sherilyn>
  8.  */
  9.  
  10. #ifndef RLPR_COMMON_H
  11. #define RLPR_COMMON_H
  12.  
  13. #include <errno.h>
  14.  
  15. #ifdef sparc
  16. #include <netdb.h>                        /* braindamage for MAXHOSTNAMELEN */
  17. #else /* NOT sparc */
  18. #include <sys/param.h>
  19. #endif
  20.  
  21. #define VERSION           "1.13"
  22.  
  23. /* this is the port the proxy listens on (rlprd) and the client
  24.  * connects to to contact the proxy. it can be whatever you want
  25.  * as long as the client and the server are both in agreement.
  26.  * note that putting it below 1024 is asinine.
  27.  */
  28.  
  29. #define RLPRD_TO_NUM      7290
  30.  
  31. /* reliable and writeable temp directory */
  32. #define TMPDIR            "/tmp/"
  33.  
  34. /* environment variable names */
  35. #define PRINTHOST         "RLPR_PRINTHOST"
  36. #define PROXY             "RLPR_PROXY"
  37.  
  38. /* i made these up because i couldn't find a good source for them */
  39. #define MAX_STR_LEN       255
  40. #define MAX_FILE_LEN      64              /* NOT DEFINED IN RFC 1179! */
  41. #define MAX_QUEUE_LEN     64              /* NOT DEFINED IN RFC 1179! */
  42.  
  43. /* NOTHING BELOW THIS POINT SHOULD NEED TO BE CHANGED */
  44.  
  45. /* FROM RFC 1179 */
  46. #define MAX_USER_LEN      31
  47. #define MAX_SOURCE_LEN    131
  48. #define MAX_HOST_LEN      31
  49. #define MAX_JOB_LEN       99
  50. #define MAX_CLASS_LEN     31
  51. #define MAX_TITLE_LEN     79
  52.  
  53. #define LO_LPD_FROM_NUM   721             /* INCLUSIVE */
  54. #define HI_LPD_FROM_NUM   731             /* INCLUSIVE */
  55. #define LPD_TO_NUM        515
  56.  
  57. /* odds and ends */
  58. #define ERRNO (strerror(errno))
  59.  
  60. /* printing attributes struct */
  61.  
  62. typedef struct print_attr_ {
  63.   char         filetype;                  /* format of file to print */
  64.   int          fflag:1;                   /* form feed after printing? */
  65.   int           mflag:1;                   /* mail after printing? */
  66.   int           rflag:1;                   /* remove file after printing? */
  67.   int           bflag:1;                   /* burst page flag (1 = print it) */
  68.   int           qflag:1;                   /* quiet flag (1 = quiet) */
  69.   int           wflag:1;              /* windows flag (for braindead lpd's) */
  70.   unsigned int icols;                     /* number of cols to indent with -i */
  71.   unsigned int copies;                    /* number of copies to print*/
  72.   unsigned int width;                     /* width of page */
  73.  
  74.   /* these fields are MAX + 1 so they can hold the null byte */
  75.  
  76.   char currhost[MAXHOSTNAMELEN+1];        /* hostname we're currently on */
  77.   char proxyhost[MAXHOSTNAMELEN+1];       /* hostname of proxy to go through */
  78.   char printhost[MAXHOSTNAMELEN+1];       /* hostname of printer to print to */
  79.   char class[MAX_CLASS_LEN+1];            /* job classification on burst page */
  80.   char printer[MAX_QUEUE_LEN+1];          /* name of printer queue */
  81.   char user[MAX_USER_LEN+1];              /* user name to print on burst page */
  82.   char job[MAX_JOB_LEN+1];                /* job name to print on burst page */
  83.   char title[MAX_TITLE_LEN+1];            /* title (optional for pr) */
  84. } print_attr;                             /* convenience */
  85.  
  86. /* global variables */
  87. char *name;                               /* argv[0] */
  88. char local_hostname[MAXHOSTNAMELEN];      /* host rlpr client is on */
  89. int  sockfd;                              /* socket we're using */
  90. print_attr opts_;                         /* global options struct */
  91.  
  92. /* function prototypes */
  93. void  rlpr_fatal(char *fmt, ...);         /* print a fatal error message */
  94. void  rlpr_warn(char *fmt, ...);          /* print a warning */
  95. void  get_local_hostname(void);           /* get local hostname */
  96. void  strlower(char *str);                /* lowercase a string */
  97. off_t filesz(int fd);                  /* find size of a file */
  98.  
  99. #endif /* RLPR_COMMON_H */
  100.